package cn.wolfcode.shop.cloud.service.impl;

import cn.wolfcode.shop.cloud.common.Result;
import cn.wolfcode.shop.cloud.domain.Good;
import cn.wolfcode.shop.cloud.mapper.GoodMapper;
import cn.wolfcode.shop.cloud.service.IGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;

@Service
public class GoodServiceImpl implements IGoodService {

    @Autowired
    private GoodMapper goodMapper;

    public List<Good> queryByGoodIds(Set<Long> goodIds) {
        //把set集合转化为list集合，方便后续遍历
        if (goodIds!=null && goodIds.size()>0){
            List  arrayList = new ArrayList (goodIds);
            return goodMapper.queryGoods(arrayList);
        }

        return Collections.emptyList();
    }
}
